<template>
	<view class="my">
		<!-- 背景图 -->
		<view class="bjImage">
			<image src="@/static/my/Group 1556.png" mode=""></image>
			<view class="k" style="display: flex;">
				<image :src="image + userList.face" mode=""></image>
				<view class="name" style="font-size: 36rpx;" v-if="userList.nickName">{{userList.nickName}}</view>
				<view class="name" style="font-size: 36rpx;" v-else  @tap.stop="Jump('/pages/login/login')">登录</view>
			</view>
		</view>
		<!-- 用户信息 -->
		<view class="infoBox">
			<!-- <view class="info_t flex-r-b-c">
				<image :src="myData.avatar" mode=""></image>
				<view class="info_t_r">
					<view class="info flex-r-b-c">
						<view class="info_l flex-r-c-c">
							<view class="name">{{myData.nickname?myData.nickname:'登录'}}{{myData.lvl != 3 ? '（推客）' :''}}</view>
							<image style="margin-left: 20rpx;" v-if="myData.lvl != 3" :src="myData.lvl == 2 ? '/static/my/fhy.png' : '/static/my/hy.png'" mode=""></image>
						</view>
						<u-icon name="chat" size="40" color="#000000" @tap.stop="Jump('/pages/my/pkNotice/pkNotice')"></u-icon>
					</view>
					<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" style="text-align: left; width: 50%; color: #000; font-size: 28rpx; font-weight: 400; " hover-class='none' v-if="mobile == ''">点击获取手机号</button>
					<view class="tel" v-else>{{mobile}}</view>
				</view>
			</view> -->
			
			<view class="info_b flex-r-b-c">
				<view class="three1" v-for="(i,index) in three1List" :key="index">
					<view class="">
						<image :src="i.url" mode=""  style="width: 30rpx;height: 28rpx;"></image>
					</view>
					<view class="" style="font-size: 24rpx;line-height: 17px">
						{{i.title}}
					</view>
					<view class="" :style="{color:i.color}" style="font-size: 22rpx;">
						{{i.des}}
					</view>
				</view>
			</view>
			
		</view>
		<!-- 会员 -->
		<view class="" style="margin-top: 30rpx;">
			<view class="" style="text-align: center;margin-bottom: -50rpx;">
				<image src="@/static/my/Subtract.png" style="width: 94%;height: 96rpx" mode="" ></image>
				<!-- <text class="record">回收记录</text> -->
			</view>
			<view class="member flex-r-b-c"  >
				
				<view class="member_l">
					<view class="title">审核中</view>
					<view class="text">{{myData.waitCount||0}}</view>
				</view>
				<view class="line"></view>
				<view class="member_l">
					<view class="title">已通过</view>
					<view class="text">{{myData.passCount||0}}</view>
				</view>
				<view class="line"></view>
				<view class="member_l">
					<view class="title">未通过</view>
					<view class="text">{{myData.failCount||0}}</view>
				</view>
				<!-- <view class="member_r">加入会员</view> -->
			</view>
		</view>
		
		<!-- 列表 -->
		<view class="listBox">
			<view class="list flex-r-b-c" v-for="(i,index) in three3List" :key="index">
				<view class="list_l" @tap.stop="Jump(i.path)">
					<view class="" style="width: 200rpx;">
						<image :src="i.url" mode=""></image>
					</view>
					<view class="text">{{i.title}}</view>
				</view>
				<!-- <u-icon name="arrow-right" size="32" color="#B6B6B6"></u-icon> -->
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myData: {},
				userList:{},
				mobile:'',
				image: this.$base.smallimgUrl,
				isDisable:0,
				three1List:[
					{
						url:'/static/my/t1.png',
						title:'佣金',
						des:'1231',
						color:'#FD6C6C'
					},
					{
						url:'/static/my/t2.png',
						title:'会员等级',
						des:'Lv1',
						color:'#3DAD81'
					},
					{
						url:'/static/my/t3.png',
						title:'我的积分',
						des:'1231',
						color:'#8C7BFD'
					},
				],
				three3List:[
					{
						url:'/static/my/t4.png',
						title:'积分明细',
						path:'/pages/my/memberDetails/memberDetails'
					},
					{
						url:'/static/my/t5.png',
						title:'我的邀请',
						path:'/pages/my/myInvited/myInvited'
					},
					{
						url:'/static/my/t6.png',
						title:'分享海报',
						path:'/pages/my/imagePage/imagePage?type=1'
					},
					{
						url:'/static/my/t7.png',
						title:'会员中心',
						path:'/pages/my/member/member'
					},
					{
						url:'/static/my/t8.png',
						title:'更新资料',
						path:'/pages/my/accountCard/accountCard'
					},
					{
						url:'/static/my/t9.png',
						title:'佣金明细',
						path:'/pages/my/moneyDetails/moneyDetails'
					},
				]
			};
		},
		onShow() {
			this.getUserInfo()
			this.getMyData()
			this.mobile = uni.getStorageSync('mobile')? uni.getStorageSync('mobile'):''
		},
		methods: {
			// 点击跳转收益
			toProfit(){
				uni.navigateTo({
					url: '/pages/my/profit/profit'
				})
			},
			// 获取回收记录
			getMyData(){
				let that = this
				that.$api.scanCodeRecordCount().then(res => {
					that.myData = res.data.data
					// uni.setStorageSync('userInfo',that.myData)
				})
			},
			// 获取用户信息
			getUserInfo(){
				let that = this
				that.$api.getUserInfo().then(res => {
					// console.log(res.data.data,'that.userList')
					that.userList = res.data.data
					console.log(this.$base.smallimgUrl+that.userList.face,'that.userList')
					that.three1List[0].des = that.userList.commission||0
					that.three1List[1].des = `Lv-${that.userList.memberLevel}`
					that.three1List[2].des = that.userList.point||0
					uni.setStorageSync('point',that.userList.point)
					uni.setStorageSync('level',that.userList.memberLevel)
					uni.setStorageSync('commission',that.userList.commission)
					that.isDisable = res.data.data.isDisable
					console.log(that.isDisable,'that.isDisabl')
					if(that.isDisable == 1){
						uni.removeStorageSync('token')
					}
					// uni.setStorageSync('userInfo',that.myData)
				})
			},
				
			// 跳转
			Jump(url){
				if(url == '/pages/my/imagePage/imagePage?type=1'&& this.userList.memberLevel == 1){
					this.$utils.toast('会员等级不够，请先升级')
				}else{
					uni.navigateTo({
						url: url
					})
				}
			},
			
			// 获取手机号
			getPhoneNumber(e){
				let that = this
				that.$api.getMobile({
					...e.detail
				}).then(res => {
					this.mobile = res.data.data.mobile
					uni.setStorageSync('mobile',this.mobile)
					// that.getMyData()
				})
			},
			
			// 加入会员
			goMsember(){
				uni.navigateTo({
					url: '/pages/my/member/member'
				})
			}
			
		}
	}
</script>

<style lang="less">
	page{
		background-color: #f9f9f9;
	}
	button {
		margin: 0;
		padding: 0;
		border: none;
		background: none;
	}
	
	button::after {
		border: none;
	}
	.record{
		position: absolute;
		left: 9%;
		top: 42%;
		color: #fff;
		font-size: 22rpx;
		z-index: 1000;
	}
	.my{
		width: 100vw;
		
		.bjImage{
			width: 100%;
			image{
				width: 100%;

			}
			.k{
				width: 800rpx;
				height: 200rpx;
				display: flex;
				border: 1px soild black;
				position: absolute;
				top: 240rpx;
				left: 50rpx;
				overflow: hidden;
				// border-radius: 50%;
				image{
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
				}
				.name{
					height: 120rpx;
					line-height: 120rpx;
					margin-left: 30rpx;
					color: #000;
					// font-weight: 600;
				}
			}
			
		}
		
		.infoBox{
			width: 90%;
			height: 154rpx;
			border-radius: 20rpx;
			// background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, #FFFFFF 100%);
			background: #FFFFFF;
			backdrop-filter: blur(10px);
			margin: 0 auto;
			margin-top: -58rpx;
			padding: 10rpx 30rpx;
			
			.info_t{
				width: 100%;
				padding-bottom: 30rpx;
				border-bottom: 1px solid #EFEFEF;
				image{
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
				}
				
				.info_t_r{
					width: 75%;
					font-size: 28rpx;
					font-weight: 400;
					color: #000;
					.info{
						width: 100%;
						.info_l{
							image{
								width: 42rpx;
								height: 42rpx;
								border-radius: 0;
							}
						}
					}
					.tel{
						margin-top: 20rpx;
					}
				}
				
			}
			
			
			.info_b{
				padding: 20rpx 40rpx;
				.three1{
					text-align: center;
					width: 140rpx;
					height: 140rpx;
				}
				.info_b_l{
					width: 50%;
					text-align: center;
					font-size: 24rpx;
					font-weight: 400;
					color: #474747;
					.money{
						font-size: 32rpx;
						font-weight: 500;
						color: #000;
						margin-top: 20rpx;
					}
				}
				.btn{
					width: 180rpx;
					height: 62rpx;
					line-height: 62rpx;
					background-color: #000;
					text-align: center;
					border-radius: 62rpx;
					color: #fff;
					font-size: 24rpx;
					font-weight: 400;
				}
			}
			
			
		}
		
		
		.member{
			width: 90%;
			height: 136rpx;
			border-radius: 20rpx;
			background-color: #fff;
			padding: 30rpx;
			margin: 0rpx auto 40rpx;
			.line{
				background: rgba(217, 217, 217, 0.4);
				height: 70rpx;
				line-height: 70rpx;
				width: 3rpx;
			}
			.member_l{
				font-size: 24rpx;
				font-weight: 400;
				color: #7F8084;
				text-align: center;
				margin: 0 auto;
				.title{
					font-size: 28rpx;
					font-weight: 500;
					color: #000;
					margin-bottom: 10rpx;
				}
				.text{
					color: #3DAD81;
				}
			}
			.member_r{
				width: 136rpx;
				height: 60rpx;
				line-height: 60rpx;
				text-align: center;
				background: #000;
				border-radius: 60rpx;
				font-size: 24rpx;
				font-weight: 400;
				color: #fff;
			}
		}
		
		.listBox{
			width: 90%;
			margin: 40rpx auto;
			background: #fff;
			border-radius: 20rpx;
			padding: 30rpx;
			display: flex;
			flex-wrap: wrap;
			text-align: center;
			.list{
				width: 33%;
				text-align: center;
				margin: 0 auto;
				padding-top: 10rpx;
				// border: 1px solid gray;
				.list_l{
					text-align: center;
					margin: 10rpx 0;
					image{
						width: 40rpx;
						height: 40rpx;
						margin-bottom: 10rpx;
					}
					.text{
						font-size: 28rpx;
						font-weight: 400;
						margin-bottom: 10rpx;
					}
				}
			}
		}
		
	}
</style>
